/******************************************************************************
 * * setting_global.h - data structure for setting module
 *
 * *(C) Copyright 2019 Asr International Ltd.
 * * All Rights Reserved
 * ******************************************************************************/
#ifndef SETTING_GLOBAL_H
#define SETTING_GLOBAL_H

#ifdef __cplusplus
extern "C" {
#endif

/**********************
*      INCLUDES
**********************/
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "ui_type.h"
#include "../../lvgl/hal/hal.h"
#include "ui_log.h"
#include "modem/mmi_modemadp_interface.h"
#include "inter_common_ui_interface.h"
#include "inter_setting_interface.h"
#include "inter_contacts_interface.h"
#include "inter_framework_interface.h"
#include "inter_call_setting_interface.h"
#include "inter_audio_player_interface.h"
#include "ui_nvm_interface.h"
#include "nav.h"
#include "ui_ringtone.h"
#include "setting_dualsim.h"
#include "setting_tone.h"
#include "setting_profile.h"
#include "setting_time.h"
#include "setting_call.h"
#include "setting_phone.h"
#include "setting_security.h"
#include "setting_display.h"
#include "setting_bluetooth.h"
#include "ui_ime.h"
#include "../../lvgl/hal/hal_wlan.h"

/**********************
*      TYPEDEFS
**********************/
typedef struct
{
    UINT8 RingNum;                                                              // FFS20190419: saved ring number in nvm (re-defined with nvm ?)
    UINT8 RingID[10];                                                           // FFS20190419: saved ring ID in nvm, note: the value must be larger than PHONE_TEXT_ID_MAX (re-defined with nvm ?)
} Setting_NVM_Para_t;

typedef VOID (*SettingSimSelectedCallback)(MMI_MODEM_SIM_ID SimId);             // Call back func for SIM selected

// setting segments length & offset
#define NV_SETTING_DUAL_SETTING_LEN           sizeof(NV_Setting_Dual_Setting_t)
#define NV_SETTING_TONE_SETTING_LEN           sizeof(NV_Setting_Tone_Setting_t)
#define NV_SETTING_DISPLAY_SETTING_LEN        sizeof(NV_Setting_Display_Setting_t)
#define NV_SETTING_PROFILE_SETTING_LEN        sizeof(NV_Setting_Profile_Setting_t)
#define NV_SETTING_TIME_SETTING_LEN           sizeof(NV_Setting_Time_Setting_t)
#define NV_SETTING_CALL_SETTING_LEN           sizeof(NV_Setting_Call_Setting_t)
#define NV_SETTING_PHONE_SETTING_LEN          sizeof(NV_Setting_Phone_Setting_t)
#define NV_SETTING_SECURITY_SETTING_LEN       sizeof(NV_Setting_Security_Setting_t)
#define NV_SETTING_SECURITY_CODE_LEN          4
#define NV_SETTING_SECURITY_STAT_LEN          1

#define NV_SETTING_DUAL_SETTING_OFFSET        0
#define NV_SETTING_TONE_SETTING_OFFSET        (NV_SETTING_DUAL_SETTING_OFFSET + NV_SETTING_DUAL_SETTING_LEN)
#define NV_SETTING_DISPLAY_SETTING_OFFSET     (NV_SETTING_TONE_SETTING_OFFSET + NV_SETTING_TONE_SETTING_LEN)
#define NV_SETTING_PROFILE_SETTING_OFFSET     (NV_SETTING_DISPLAY_SETTING_OFFSET + NV_SETTING_DISPLAY_SETTING_LEN)
#define NV_SETTING_TIME_SETTING_OFFSET        (NV_SETTING_PROFILE_SETTING_OFFSET + NV_SETTING_PROFILE_SETTING_LEN)
#define NV_SETTING_CALL_SETTING_OFFSET        (NV_SETTING_TIME_SETTING_OFFSET + NV_SETTING_TIME_SETTING_LEN)
#define NV_SETTING_PHONE_SETTING_OFFSET       (NV_SETTING_CALL_SETTING_OFFSET + NV_SETTING_CALL_SETTING_LEN)
#define NV_SETTING_SECURITY_SETTING_OFFSET    (NV_SETTING_PHONE_SETTING_OFFSET + NV_SETTING_PHONE_SETTING_LEN)
#define NV_SETTING_SECURITY_CODE_OFFSET       NV_SETTING_SECURITY_SETTING_OFFSET
#define NV_SETTING_SECURITY_STAT_OFFSET       NV_SETTING_SECURITY_CODE_OFFSET + NV_SETTING_SECURITY_CODE_LEN

// declare audio file for temp, begin
#define SETTING_AUDIO_POWER_ON                "R:/audio/audio_power_on_phone.mid"
#define SETTING_AUDIO_MSG                     "R:/audio/audio_msg_phone.amr"
// end

/**********************
* GLOBAL VARIABLES
**********************/
extern BOOL g_SettingSimStatus[2];

/**********************
* GLOBAL PROTOTYPES
**********************/
extern VOID Setting_Call_Init_Req(NV_UI_Settings_t *pNvPara);
extern VOID Setting_Dualsim_Init_Req(NV_UI_Settings_t *pNvPara);
extern VOID Setting_Display_Init_Req(NV_UI_Settings_t *pNvPara);
extern VOID Setting_Phone_Init_Req(NV_UI_Settings_t *pNvPara);
extern VOID Setting_Profile_Init_Req(NV_UI_Settings_t *pNvPara);
extern VOID Setting_Security_Init_Req(NV_UI_Settings_t *pNvPara);
extern VOID Setting_Time_Init_Req(NV_UI_Settings_t *pNvPara);
extern VOID Setting_Tone_Init_Req(NV_UI_Settings_t *pNvPara);
extern VOID Display_Setting_Done(ACTIVITY_ID CallerActId,UI_PHONE_TEXT_ID TxtId,ACTIVITY_ID AutoNextActId);
extern VOID Display_Setting_SIM_Selection(ACTIVITY_ID CallerActId,UI_PHONE_TEXT_ID Sim1ValueTxtId,UI_PHONE_TEXT_ID Sim2ValueTxtId,INT8 *Sim1Txt,INT8 *SIm2Txt,SettingSimSelectedCallback SimActionCb);
extern VOID Display_Setting_Error(ACTIVITY_ID CallerActId,UI_PHONE_TEXT_ID TxtId,ACTIVITY_ID NextActId,BOOL AutoToNextActEnabled);
extern VOID Display_Setting_On_Off(ACTIVITY_ID CallerActId, UI_PHONE_TEXT_ID TitleTxtId, UINT8 CurSetting, lv_event_cb_t OnActionCb, lv_event_cb_t OffActionCb);

extern VOID Display_Setting_SIM_Selection_Set(UI_PHONE_TEXT_ID Sim1ValueTxtId, UI_PHONE_TEXT_ID Sim2ValueTxtId, INT8 *Sim1Txt, INT8 *Sim2Txt);

extern VOID Display_Setting_Dual_Sim_Settings_Cb(lv_obj_t *Btn, lv_event_t Event);
extern VOID Display_Setting_Tone_Settings_Cb(lv_obj_t *Btn, lv_event_t Event);
extern VOID Display_Setting_Display_Settings_Cb(lv_obj_t *Btn, lv_event_t Event);
extern VOID Display_Setting_Profiles_List_Cb(lv_obj_t *Btn, lv_event_t Event);
extern VOID Display_Setting_Time_Settings_Cb(lv_obj_t *Btn, lv_event_t Event);
extern VOID Display_Setting_Call_Settings_Cb(lv_obj_t *Btn, lv_event_t Event);
extern VOID Display_Setting_Phone_Settings_Cb(lv_obj_t *Btn, lv_event_t Event);
extern VOID Display_Setting_Security_Settings_Cb(lv_obj_t *Btn, lv_event_t Event);
extern VOID Display_Setting_Security_Restore_Factory_Cb(lv_obj_t *Btn, lv_event_t Event);
extern VOID Display_Setting_Volte_Switch_Cb(lv_obj_t *Btn, lv_event_t Event);
#if USE_LV_WLAN != 0
extern VOID Display_Setting_Wlan_Cb(lv_obj_t * Btn, lv_event_t Event);
#endif

extern VOID Display_Settings(VOID);
extern lv_res_t Display_Settings_Cb(lv_obj_t *Btn);

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /*SETTING_GLOBAL_H*/
